package com.mbl.base.modular.member.controller;


import com.alibaba.fastjson.JSONArray;
import com.mbl.base.core.utils.UtilSecurity;
import com.mbl.base.modular.member.entity.Feedback;
import com.mbl.base.modular.member.service.IFeedbackService;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;
import com.mbl.base.core.common.controller.BaseController;

/**
 * <p>
 * 意见反馈表 前端控制器
 * </p>
 *
 * @author lwj
 * @since 2020-03-24
 */
@RestController
@RequestMapping("/member/feedback")
public class FeedbackController extends BaseController<Feedback, IFeedbackService> {

    @Override
    public void machiningAdd(Feedback obj) {
        /**
         * 添加逻辑处理
         */
        obj.setUserId(UtilSecurity.getUser().getId());
        obj.setStatus(0);
        obj.setHasPicture(false);
        final JSONArray picUrls = obj.getPicUrls();
        if(picUrls != null && picUrls.size() > 0){
            obj.setHasPicture(true);
        }
        super.machiningAdd(obj);
    }
}

